package com.sanchunhui.presenter


import com.sanchunhui.presenter.view.ResetPwdView
import com.sanchunhui.psc.common.BaseApplication
import com.sanchunhui.psc.data.protocol.ResponseInfo
import com.sanchunhui.psc.ext.excute
import com.sanchunhui.psc.presenter.BasePresenter
import com.sanchunhui.psc.rx.BaseSubscriber
import com.sanchunhui.psc.service.UserService
import javax.inject.Inject

/*
    重置密码Presenter
 */
class ResetPwdPresenter @Inject constructor() : BasePresenter<ResetPwdView>() {

    @Inject
    lateinit var userService: UserService

    /*
        重置密码
     */
    fun resetPwd(token:String,old_password: String, new_password: String) {
        if (!checkNetWork()) {
            return
        }
        mView.showLoading()
        userService.resetPwd(token, old_password, new_password).excute(object : BaseSubscriber<ResponseInfo>(mView) {
            override fun onNext(t: ResponseInfo) {
                    mView.onResetPwdResult(t)
            }
        }, lifecycleProvider)

    }

}
